/*
 * @Description: 时间工具
 * @Author: franktrue 807615827@qq.com
 * @Date: 2021-07-27 11:01:33
 * @LastEditTime: 2021-07-27 12:24:20
 */
package timer

import (
	"time"
)

// 获取当前时间
func GetNowTime() time.Time {
	location, _ := time.LoadLocation("Asia/Shanghai")
	return time.Now().In(location)
}

// 推算时间
func GetCalculateTime(currentTimer time.Time, d string) (time.Time, error) {
	duration, err := time.ParseDuration(d)
	if err != nil {
		return time.Time{}, err
	}
	location, _ := time.LoadLocation("Asia/Shanghai")
	return currentTimer.Add(duration).In(location), nil
}
